import 'dart:io';

import 'package:dd_check_plugin/dd_check_plugin.dart';
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:music_pc/route/routes.dart';
import 'package:window_manager/window_manager.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  DdCheckPlugin().init(
    Dio(),
    initHost: '127.0.0.1', // Change to your computer IP
    port: 9999, // Modify the listening port to, default to 9999
    projectName: "SrMusic", // Custom Project Name
  );
  await windowManager.ensureInitialized();
  const size = Size(1152, 800);
  WindowOptions windowOptions = WindowOptions(
    size: size,
    minimumSize: size,
    maximumSize: size,
    fullScreen: false,
    center: true,
    backgroundColor: Colors.transparent,
    skipTaskbar: false,
    titleBarStyle: TitleBarStyle.hidden,
  );
  windowManager.waitUntilReadyToShow(windowOptions, () async {
    await windowManager.show();
    await windowManager.focus();
  });

  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'SR_MUSIC',
      theme: ThemeData(textTheme: TextTheme()),
      routes: routes,
      initialRoute: '/root',
    );
  }
}
